package com.plian.system.dao.sys.per;

import com.plian.Tools.pagedata.PageData;
import com.plian.system.dao.DaoSupport;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

@Component
public class BusUserOrgDao {
    @Resource(name = "daoSupport")
    private DaoSupport dao;
    /**
     * 新增用户单位
     */
    public void userOrgConfig(List<PageData> list) throws Exception {
        dao.save("BusUserOrgMapper.userOrgConfig",list);
    }
    /**
     * 根据用户Id删除相关单位权限
     * @param userId
     * @throws Exception
     */
    public void del_orgUser(String userId) throws Exception {
        dao.delete("BusUserOrgMapper.del_orgUser",userId);
    }
    /**
     * 根据单位Id删除相关单位权限
     * @param list
     * @throws Exception
     */
    public void del_ids(List<String> list) throws Exception {
        dao.delete("BusUserOrgMapper.del_ids",list);
    }
    /**
     * 根据用户id查询有权限的单位
     * @param userId
     * @throws Exception
     * @return
     */
    public List<PageData> queryUserOrg(String userId) throws Exception {
       return (List<PageData>) dao.findForList("BusUserOrgMapper.queryUserOrg",userId);
    }
    public List<PageData> queryUserOrgList(String userId) throws Exception {
       return (List<PageData>) dao.findForList("BusUserOrgMapper.queryUserOrgList",userId);
    }


}
